home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / file-tra / fsp-2.7 / fsp-2 / fsp / clients / frmcmd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-24  |  1.3 KB  |  51 lines

  1.     /*********************************************************************\
  2.     *  Copyright (c) 1991 by Wen-King Su (wen-king@vlsi.cs.caltech.edu)   *
  3.     *                                                                     *
  4.     *  You may copy or modify this file in any manner you wish, provided  *
  5.     *  that this notice is always included, and that you hold the author  *
  6.     *  harmless for any loss or damage resulting from the installation or *
  7.     *  use of this software.                                              *
  8.     \*********************************************************************/
  9.  
  10. #include "tweak.h"
  11. #include "client_def.h"
  12. #include "c_extern.h"
  13. #include "bsd_extern.h"
  14.  
  15. static int remove_it PROTO1(char *, p)
  16. {
  17.   char *op;
  18.   UBUF *ub;
  19.   
  20.   op = util_abs_path(p);
  21.   
  22.   ub = client_interact(CC_DEL_FILE,0L, strlen(op), (unsigned char *)op+1, 0,
  23.                (unsigned char *)NULLP);
  24.   
  25.   if(ub->cmd == CC_ERR) {
  26.     fprintf(stderr,"Can't remove %s: %s\n",p,ub->buf);
  27.     free(op); return(-1);
  28.   }
  29.   return(0);
  30. }
  31.  
  32. int main PROTO3(int, argc, char **, argv, char **, envp)
  33. {
  34.   char **av, *av2[2];
  35.   
  36.   env_client();
  37.   
  38.   while(*++argv) {
  39.     if(!(av = glob(*argv))) {
  40.       av = av2;
  41.       av2[0] = *argv;
  42.       av2[1] = 0;
  43.     }
  44.     while(*av) remove_it(*av++);
  45.   }
  46.   
  47.   client_done();
  48.   
  49.   exit(0);
  50. }
  51.